﻿//********************************************************************************//
//创建日期：<创建日期，2017-9-8>
//创建作者：<孙雪婷，sunxueting@shanghai3h.com>
//功能说明：取水计划查询
//********************************************************************************//
using BLL;
using BLL.Access;
using DevExpress.Web;
using Entity;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Web.Class;
using System.Data.OleDb;

namespace Web.Pages.QuShui.DiXiaS.ChaXunGL
{
    public partial class QuShuiJHCX : BasePage
    {
        #region 属性

        /// <summary>
        /// 保存结果集1
        /// </summary>
        private DataTable dtGridTab1
        {
            get
            {
                return ViewState["dtGridTab1"] as DataTable;
            }
            set
            {
                ViewState["dtGridTab1"] = value;
            }
        }

        /// <summary>
        /// 保存结果集2
        /// </summary>
        private DataTable dtGridTab2
        {
            get
            {
                return ViewState["dtGridTab2"] as DataTable;
            }
            set
            {
                ViewState["dtGridTab2"] = value;
            }
        }

        /// <summary>
        /// 保存结果集3
        /// </summary>
        private DataTable dtGridTab3
        {
            get
            {
                return ViewState["dtGridTab3"] as DataTable;
            }
            set
            {
                ViewState["dtGridTab3"] = value;
            }
        }
        /// <summary>
        /// 保存结果集4
        /// </summary>
        private DataTable dtGridTab4
        {
            get
            {
                return ViewState["dtGridTab4"] as DataTable;
            }
            set
            {
                ViewState["dtGridTab4"] = value;
            }
        }
        #endregion

        #region 变量

        /// <summary>
        /// 数据访问操作类
        /// </summary>
        SpHelper _SpHelper = new SpHelper();
        /// <summary>
        /// 行政区
        /// </summary>
        QS_JX_XINGZHENGQBLL XZQ = new QS_JX_XINGZHENGQBLL();

        /// <summary>
        /// 管理部门
        /// </summary>
        QS_JX_BUMENXXBLL GLBM = new QS_JX_BUMENXXBLL();

        #endregion

        #region 事件

        /// <summary>
        /// 页面加载事件
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            //第一次页面加载
            if (!IsPostBack)
            {
                InitData();
            }
            gvGridTab1.DataSource = this.dtGridTab1;
            gvGridTab1.DataBind();

          
        }

        /// <summary>
        /// 查询信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnChaXun_Click(object sender, EventArgs e)
        {
            
        }


      
        #endregion

        #region 方法

        /// <summary>
        /// 初始化数据
        /// </summary>
        private void InitData()
        {
            int wtype = 1 ;
            gvGridTab1.SettingsPager.Mode = GridViewPagerMode.EndlessPaging;
            //水量年月
            int water_y_m = BusinessTool.GetSLYMorZWNY(1, wtype);
            for (int i = DateTime.Now.Year - 10; i <= DateTime.Now.Year; i++)
            {
                cmbYear.Items.Add(i.ToString(), i.ToString());
            }

            cmbYear.Value = Convert.ToInt32(water_y_m) / 100;

        }
       

        /// <summary>
        /// 加载查询数据1
        /// </summary>
        private void LoadGridData1(int wtype, string ym, string hnhw, string xzq, string ywy, int plantype, string yhh, string yhm, string yhdz, string zgbm)
        {
            this.dtGridTab1 = _SpHelper.P_QSCX_JIHUACX(wtype, 1, ym, hnhw, xzq, ywy, plantype, yhh, yhm, yhdz, zgbm).Tables[0];
            gvGridTab1.DataSource = this.dtGridTab1;
            gvGridTab1.DataBind();
            int zj = 0;
            if (this.dtGridTab1 != null && this.dtGridTab1.Rows.Count > 0)
            {
                zjlTab1.Text = "共" + this.dtGridTab1.Rows.Count.ToString() + "条";
                gvGridTab1.FocusedRowIndex = 0;

                for (int i = 0; i < dtGridTab1.Rows.Count; i++)
                {
                    zj += Convert.ToInt32(dtGridTab1.Rows[i]["I_KAICAIJH"]);
                }
            }
            txtZongLiangTab1.Text = zj.ToString();
        }

        
        #endregion

        protected void btnExport_Click(object sender, EventArgs e)
        {

            ASPxGridViewExporter1.GridViewID = "gvGridTab1";
            string sName = "开采计划";
            gvGridTab1.Settings.ShowFooter = false;
            ASPxGridViewExporter1.WriteXlsToResponse(sName);

        }
    }
}